package com.icode.core.model.house;

import com.icode.core.model.AbstractEntity;

import javax.persistence.*;
import java.util.ArrayList;
import java.util.List;

/**
 * Created with IntelliJ IDEA.
 * User: xianfei
 * Date: 15-6-11
 * Time: 下午1:39
 * To change this template use File | Settings | File Templates.
 */
//@Entity
//@Table(name = "house_base_themes")
public class HouseBaseThemes extends AbstractEntity {

    @ManyToOne
    @JoinColumn(name = "house_base_id")
    private HouseBase houseBase;

    @Column(name = "house_base_theme")
    @Enumerated(EnumType.STRING)
    private HouseBaseTheme houseBaseTheme;

    public HouseBaseThemes() {
    }

    public HouseBaseThemes(HouseBase houseBase, HouseBaseTheme houseBaseTheme) {
        this.houseBase = houseBase;
        this.houseBaseTheme = houseBaseTheme;
    }

    public static List<HouseBase> initHouseBase(List<HouseBaseThemes> list) {
        List<HouseBase> houseBases = new ArrayList<>();
        for (HouseBaseThemes h : list) {
            houseBases.add(h.houseBase());
        }
        return houseBases;
    }

    public HouseBase houseBase() {
        return houseBase;
    }

    public HouseBaseTheme houseBaseTheme() {
        return houseBaseTheme;
    }
}
